package com.design.patterns.list.listener;

import com.design.patterns.list.listener.event.RainWeatherEvent;
import com.design.patterns.list.listener.event.WeatherEvent;
import com.design.patterns.list.listener.listener.RainListener;
import com.design.patterns.list.listener.listener.WeatherListener;
import com.design.patterns.list.listener.multicaster.EventMulticaster;
import com.design.patterns.list.listener.multicaster.WeatherEventMulticaster;

/**
 * @author Wangzhiwen
 */
public class ListenerClient {

    public static void main(String[] args) {
        EventMulticaster eventMulticaster = new WeatherEventMulticaster();
        WeatherListener weatherListener = new RainListener();

        // 添加监听者
        eventMulticaster.addListener(weatherListener);

        // 广播事件
        WeatherEvent weatherEvent = new RainWeatherEvent("rain weather");
        eventMulticaster.multicastEvent(weatherEvent);
    }

}
